package com.jilian.powerstation.utils;

import android.text.TextUtils;

public class ProUtils {

    public static String getValueOne(String value1, float value2) {
        if (TextUtils.isEmpty(value1)) {
            return "0";
        }

        if (value2 == 1) {
            return value1;
        } else {
            try {
                float fValue = Float.parseFloat(value1);
                fValue = fValue * value2;
                return NumberUtils.forMatOneNumber(fValue);
            } catch (Exception e) {
                return "0";
            }

        }
    }

    public static String getValueStr(String value1) {
        if (TextUtils.isEmpty(value1)) {
            return "-";
        }
        return value1;
    }

    public static String getValueOneStr(String value1, float value2) {
        if (TextUtils.isEmpty(value1)) {
            return "-";
        }
        if (value2 == 1) {
            return value1;
        } else {
            try {
                float fValue = Float.parseFloat(value1);
                fValue = fValue * value2;
                return NumberUtils.forMatOneNumber(fValue);
            } catch (Exception e) {
                return "-";
            }

        }
    }

    public static String getValueTow(String value1, float value2) {
        if (TextUtils.isEmpty(value1)) {
            return "0";
        }

        if (value2 == 1) {
            return value1;
        } else {
            try {
                float fValue = Float.parseFloat(value1);
                fValue = fValue * value2;
                return NumberUtils.forMatNumber(fValue);
            } catch (Exception e) {
                return "-";
            }

        }
    }

    public static String getValueTwoStr(String value1, float value2) {
        if (TextUtils.isEmpty(value1)) {
            return "-";
        }
        if (value2 == 1) {
            return value1;
        } else {
            try {
                float fValue = Float.parseFloat(value1);
                fValue = fValue * value2;
                return NumberUtils.forMatNumber(fValue);
            } catch (Exception e) {
                return "-";
            }

        }
    }

    public static String getValueTowChange(String value1) {
        if (TextUtils.isEmpty(value1)) {
            return "-";
        }

        try {
            float fValue = Float.parseFloat(value1);
            if (fValue > 1000){
                fValue = fValue /1000;
                return NumberUtils.forMatNumber(fValue);
            }else{
                return value1;
            }

        } catch (Exception e) {
            return "-";
        }

    }
}
